﻿using CharmNotification;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using WeifenLuo.WinFormsUI.Docking;

namespace Hander.Forms
{
    public partial class FunctionFrm : DockContent
    {
        public delegate void OutputRecordsDlgt(string msg);

        public OutputRecordsDlgt OutputRecords { get; set; }

        public FunctionFrm()
        {
            InitializeComponent();
        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="title"></param>
        /// <param name="content"></param>
        public async void MessageAsync(string title, string content)
        {
            OutputRecords?.Invoke(content);
            await Task.Run(() =>
            {

                this.Invoke((Action)delegate
                {
                    Notification n = new Notification()
                    {
                        Title = title,
                        Text = content,
                        Duration = 2000,
                        //PlayTone = false,
                        
                    };
                    n.ShowNotification();
                });

            });
        }
    }
    
}
